package com.ximcontroller.models;

import java.util.Iterator;
import java.util.Observable;
import java.util.Vector;

public class Session extends Observable implements java.io.Serializable
{
	static final long serialVersionUID = 200911271942L;
	
	int id;
	String name;
	Vector<Action> actions;
	
	public Session()
	{
	}
	
	public int getID()
	{
		return this.id;
	}
	
	public void setID(int id)
	{
		this.id = id;
	}
	
	public void addAction(Action action)
	{
		this.actions.add(action);
	}
	
	public void removeAction(int id)
	{
		Iterator<Action> i = this.actions.iterator();
		
		while(i.hasNext())
		{
			Action a = i.next();
			
			if (a.getID() == id)
			{
				i.remove();
			}
		}
	}
	
	public Iterator<? extends Action> listActions()
	{
		return this.actions.iterator();
	}
	
	public Action getAction(int id)
	{
		return this.actions.get(id);
	}
}
